package com.hf.action;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.apache.struts2.ServletActionContext;
import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;

import tool.ClientTool;
import tool.HtmlTool;
import tool.JsonTool;
import tool.StringTool;
import tool.TimeTool;

import com.base.bean.*;
import com.base.dao.*;
import com.base.domain.ClientDetail;
import com.base.service.*;
import com.base.service.AddressService.ADD_TYPE;
import com.hf.bean.ClientFilter;
import com.hf.bean.SimpleAddress;

public class ClientAction5 extends BaseAction {

	private Integer pageNo, pageSize, total; // 页数 每页几条 共多少条记录
	private Integer opType; // 操作类型 eg：1 add 2 modify ...
	private List<ClientDetail> clientList;
	private String cjsons; // clientList转化为json 供kh_show2.jsp(客户详细信息)使用

	private Integer orderCon; // 排序条件
	private boolean isDesc=false; // 是否逆序

	private String phone1, phone2, phone3;
	private Integer phone1Id, phone2Id, phone3Id;
	private Integer phoneNum;	//电话个数
	
	private String provinceId,cityId,areaId;

	private Integer cid; // 客户id值，在修改的时候会传入
	private String name, comName, memo;
	private String[] chose1, chose2, chose3; // 多选
	private String chose4, chose5; // 单选
	private Integer chose6; // 单选
	private ClientDetail clientDetail;

	private AddressService as = AddressService.getInstance();
	private ClientService cs = ClientService.getInstance(); // 私有无geter seter

	public ClientAction5() {

	}

	/**
	 * 客户按id显示
	 * @return
	 */
	public String show() {
		this.opType=2;	//编辑模式
		this.cid = (cid == null) ? 0 : cid;
		this.cid = 117; // 实际替换
		User u=new User(1);
		
		// showDetail(Integer cid, Integer owner)
		if(this.showDetail(cid, u.getUid())<0)
			return ERROR;
		return SUCCESS;
	}

	/**
	 * 分页显示（默认以修改时间倒序）
	 * orderCon：
	 * 0：修改时间倒序  1：areaid  2:sellPlan  3:clientType
	 * @return
	 */
	public String showPage() {
		User u = new User(1); // 实际替换
		this.pageSize = 10;
		this.pageNo = 0;
		
		this.orderCon=(this.orderCon==null?0:this.orderCon);
		this.pageNo=(this.pageNo==null?0:this.pageNo);
		this.pageSize=(this.pageSize==null?0:this.pageSize);
		this.cjsons=(this.cjsons==null?"":this.cjsons);

		this.showList(u.getUid(), orderCon, isDesc, pageSize, pageNo);
		this.cjsons = HtmlTool.getInstance().htmlClientDetail(clientList)
				.toString();

		return SUCCESS;
	}
	
	/**
	 * 功能：
	 * 编辑或新增客户（基本信息／扩展信息／电话号码）包含了对姓名以及电话号码的后端验证逻辑
	 * 电话号码只能新增或者作废，作废的处理过程为：1）state＝2  2）"#"+phone 3）wasted时间记录
	 * 姓名及电话的前段验证可以采用ajax方式 具体参见com.hf.action.JsonCheck类
	 * 
	 * 使用说明：
	 * [具体使用参见main方法]
	 * 主要调用merge私有方法来处理，电话号码只能新增或者作废，作废的电话号码id取反
	 * 客户或者电话新增 对应id＝0
	 * 地址码＝“0｜0｜0”表示不变
	 * 
	 * 参数（Action类）说明：
	 * (phones <= 3)
	 * opType:
	 * 1:add 2:modify
	 * cid:
	 * 0:add >0:modify
	 * phoneNId:
	 * 0:add <0:waste (phone's id=Math.abs(phoneNId))
	 * addCodes:
	 * "0|0|0":noChange 
	 * 
	 * @param args
	 * @throws Exception
	 */
	public String edit() {
		// 实际替换
		User user = new User(1);

		cid = (cid == null) ? 0 : cid;
		phone1 = (phone1 == null ? "" : phone1.replaceAll("\\s*", ""));
		phone2 = (phone2 == null ? "" : phone2.replaceAll("\\s*", ""));
		phone3 = (phone3 == null ? "" : phone3.replaceAll("\\s*", ""));
		name = (name == null ? "" : name.replaceAll("\\s*", ""));	//去掉所有空格

		phone1Id = (phone1Id == null ? 0 : phone1Id);
		phone2Id = (phone2Id == null ? 0 : phone2Id);
		phone3Id = (phone3Id == null ? 0 : phone3Id);
		
		provinceId = (provinceId == null ? "0" : provinceId);
		cityId = (cityId == null ? "0" : cityId);
		areaId = (areaId == null ? "0" : areaId);
		
		
		comName=(comName==null?"":comName.replaceAll("\\s*", ""));	//去掉所有空格

		memo = (memo == null ? "" : memo.replaceAll("\\s*", ""));	//去掉所有空格
		chose1 = (chose1 == null ? new String[] { "" } : chose1);
		chose2 = (chose2 == null ? new String[] { "" } : chose2);
		chose3 = (chose3 == null ? new String[] { "" } : chose3);

		chose4 = (chose4 == null ? "" : chose4.trim());
		chose5 = (chose5 == null ? "" : chose5.trim());
		chose6 = (chose6 == null ? 0 : chose6);
		
		//System.out.println(this.name);

		// check start  （后台check 前台通过ajaxcheck）
		boolean result=false; 	//此处值没用
		
		try {
			if(this.opType==2){
				result=true;	//修改态的验证结果初始值
				
				if(!phone1.equals("") && phone1Id==0){		//修改时候新增电话都要验证通过
					if(cs.checkPhone(phone1)>0)
						result=result || true;
					else if(!phone1.equals(""))
						result=false;
				}
				
				if(!phone2.equals("") && phone2Id==0){
					if(cs.checkPhone(phone2)>0)
						result=result || true;
					else if(!phone2.equals(""))
						result=false;
				}
				
				if(!phone3.equals("") && phone3Id==0){
					if(cs.checkPhone(phone3)>0)
						result=result || true;
					else if(!phone3.equals(""))
						result=false;
				}
				
				//不能每个电话号码都是删除状态或为空
				if( (phone1Id<0 || phone1.equals(""))&& (phone2Id<0 || phone2.equals(""))&& (phone3Id<0 || phone3.equals(""))){
					result=false;
//					System.out.println("??");
				}
				
			}
			else if(this.opType==1){		//新增模式验证每个电话不为空时,都能验证通过
				result=false;
				
				if(!phone1.equals(""))	
					if(cs.checkPhone(phone1)>0)
						result=result || true;
					else
						result=false;
				
				if(!phone2.equals(""))	//新增模式 验证每个电话不为空 时验证通过
					if(cs.checkPhone(phone2)>0)
						result=result || true;
					else
						result=false;
				
				if(!phone3.equals(""))	//新增模式 验证每个电话不为空 时验证通过
					if(cs.checkPhone(phone3)>0)
						result=result || true;
					else
						result=false;
				
			}

			if (ClientTool.isName(name) > 0)
				result = result && false;
		} catch (Exception e) {
			this.tip = "未知错误，请联系管理员！";
			result = result && false;
			return ERROR;
		}
		
		if (!result) { // 后台验证未能通过
			this.tip = "录入的姓名或电话未能验证通过或禁止删除所有电话！";
			return ERROR;
		}	
		// check end

		
		int oppResult=0;

		// 修改模式
		if (opType == 2 && cid != 0) {
			// 编辑模式电话的修改判定依据是：phoneid＝0 新增 phoneid>0修改 phoneid<0 删除
			// System.out.println("修改开始");
			oppResult=merge(user.getUid(),2);
		}
		
		// 新增模式
		else if(opType==1 && cid==0){
			if(this.provinceId.equals("0") && this.cityId.equals("0") && this.areaId.equals("0")){
				this.tip="地址不能为空";
				return ERROR;
			}
			
			
			oppResult=merge(user.getUid(),1);
		}
		
		if(oppResult>0)
			return SUCCESS;
		else
			return ERROR;
		
	}


	
	/**
	 * 私有方法：
	 * 显示客户详细信息
	 * @param cid
	 * @param owner
	 * @return 1:成功  －1:未找到  －2:异常
	 */
	
	private int showDetail(Integer cid,Integer owner){
		this.clientDetail=new ClientDetail();
		this.tip="";
		try{
		List<ClientBase> cbs=cs.getClientBaseDao().findByHql("from ClientBase cb where cb.cid="+cid+" and cb.owner="+owner);
		ClientBase cb=null;
		ClientExtend ce=null;
		List<ClientPhone> cps=null;
		if(cbs.size()>0){
			cb=cbs.get(0);
			ce=cs.getClientExtendDao().findByHql("from ClientExtend ce where ce.cid="+cid).get(0);
			//按创建时间逆序
			cps=cs.getClientPhoneDao().findByHql("from ClientPhone cp where cp.state=1 and cp.cid="+cid+" order by cp.created desc");
			this.clientDetail.setClientBase(cb);
			this.clientDetail.setClientExtend(ce);
//			this.chose1=ce.getYywjj().split(",");
//			this.chose2=ce.getYyzzj().split(",");
//			this.chose3=ce.getYgsbType().split(",");
//			this.chose4=ce.getClientType();
//			this.chose5=ce.getIsZan();
			
			this.clientDetail.setClientPhones(cps);
			this.phoneNum=cps.size();
			return 1;
		}
		else{
			this.tip="您所拥有的客户群中未找该客户";
			return -1;
		}
		}catch(Exception e){
			this.tip="出现异常，请联系管理员";
			e.printStackTrace();
			return -2;
		}
	}
	
	/**
	 * 私有方法：
	 * 按条件 按页显示客户
	 * 
	 * 排序条件：
	 * 达成期限 分类 区域 是否有提醒？？ 创建时间  修改时间？？
	 * 用事务来查询 组合条件查询
	 * @param orderType
	 * @param isDesc
	 * @param pageSize
	 * @param pageNo
	 * @return
	 */
	private int showList(int owner,int orderType,boolean isDesc,int pageSize,int pageNo){	
		this.clientList=null;
		this.cjsons=null;		//json字串对应clientList
		
		Session session = cs.getClientBaseDao().getSessionFactory().getCurrentSession();
		Criteria criteria=null;
		Transaction tx=null;
		try{
		tx = session.beginTransaction();
			
		criteria = session.createCriteria(ClientBase.class);
		criteria.add(Restrictions.eq("owner", owner));
		criteria.setProjection(Projections.count("cid"));
		this.total=(Integer) criteria.list().get(0);	//自己所属客户总数
				
		List<Integer> cids=null;
				
		ProjectionList proList = Projections.projectionList();//设置投影集合   cid
		proList.add(Projections.groupProperty( "cid"));
		
		criteria = session.createCriteria(ClientBase.class);
		criteria.add(Restrictions.eq("owner", owner));	//自己拥有的客户  
		
		//order con start
		switch(orderType){
		case 0:			//默认按照修改时间排序
			if(isDesc)
				criteria.addOrder(Order.desc("modified"));
			else
				criteria.addOrder(Order.asc("modified"));
			break;
		case 1:	//按areaId
			if(isDesc)
				criteria.addOrder(Order.desc("areaId"));
			else
				criteria.addOrder(Order.asc("areaId"));
			break;
		case 2:	//sellPlan
			criteria = session.createCriteria(ClientExtend.class);
			criteria.add(Restrictions.eq("owner", owner));
			criteria.add(Restrictions.isNotNull("sellPlan"));	//注意：这样的话总数就不再=total
			if(isDesc)
				criteria.addOrder(Order.desc("sellPlan"));
			else
				criteria.addOrder(Order.asc("sellPlan"));
			break;
		case 3:		//clientType
			criteria = session.createCriteria(ClientExtend.class);
			criteria.add(Restrictions.eq("owner", owner));
			criteria.add(Restrictions.isNotNull("clientType"));	//注意：这样的话总数就不再=total
			if(isDesc)
				criteria.addOrder(Order.desc("clientType"));
			else
				criteria.addOrder(Order.asc("clientType"));
		}
		
		criteria.setProjection(proList); 
		//order con end
		criteria.setFirstResult(pageSize*pageNo);
		criteria.setMaxResults(pageSize);
		cids=criteria.list();
		
		this.clientList=new ArrayList<ClientDetail>();
		for(Integer cid:cids){
			System.out.println(cid);		//test delete 
			ClientBase cb=(ClientBase) session.createCriteria(ClientBase.class).add(Restrictions.eq("cid", cid)).list().get(0);
			ClientExtend ce=(ClientExtend) session.createCriteria(ClientExtend.class).add(Restrictions.eq("cid", cid)).list().get(0);
			List<ClientPhone> cps=session.createCriteria(ClientPhone.class).add(Restrictions.eq("cid", cid)).add(Restrictions.eq("state",1)).list();
			ClientDetail cd=new ClientDetail();
			cd.setClientBase(cb);
			cd.setClientExtend(ce);
			cd.setClientPhones(cps);
			if(ce.getSellPlan()!=null)
				cd.setSellPlanRate(TimeTool.fromTodayRate(ce.getSellPlan(), 100));
			this.clientList.add(cd);
		}
		
		tx.commit();
		}finally{
			if(session.isOpen())
				session.close();
		}
		return 1;
	}
	
	private int merge(Integer creatorId, Integer oppType) {
		boolean isOwn = false;
		ClientBase cb=null;
		List<ClientPhone> cps=null;
		
		//clientExtend 无论如何都可以写入（不管是否是由自己创建的）
		ClientExtend ce=new ClientExtend();
		ce.setCid(this.cid);
		ce.setModified(TimeTool.getCurrentTime());
		ce.setMemo(memo);
		ce.setOwner(creatorId);
		ce.setYywjj(StringTool.arrToStr(chose1));
		ce.setYyzzj(StringTool.arrToStr(chose2));
		ce.setYgsbType(StringTool.arrToStr(chose3));
		ce.setClientType(chose4);
		ce.setIsZan(chose5);
		if(chose6!=0)
			ce.setSellPlan(TimeTool.nMonthLeater(chose6));	
		
		
		
		
		cb=new ClientBase();
		cb.setCid(cid);
		cb.setProvinceId(provinceId);
		cb.setCityId(cityId);
		cb.setAreaId(areaId);	
		
		
		if(!provinceId.equals("0"))
			cb.setProvince(as.getNameByCode(ADD_TYPE.PROVINCE, provinceId));
		if(!cityId.equals("0"))
			cb.setCity(as.getNameByCode(ADD_TYPE.CITY, cityId));
		if(!areaId.equals("0"))
			cb.setArea(as.getNameByCode(ADD_TYPE.AREA, areaId));
		
		
		
		cb.setName(name);
		cb.setComName(comName);
		cb.setModified(TimeTool.getCurrentTime());
		cb.setCreator(creatorId);
		cb.setOwner(creatorId);
		cb.setState(1);
		
		cps=new ArrayList<ClientPhone>();
		ClientPhone cp1=new ClientPhone();
		cp1.setCid(cid);
		cp1.setCreator(creatorId);
		cp1.setState(1);
		cp1.setPhone(phone1);
		cp1.setId(phone1Id);
		cp1.setCreated(TimeTool.getCurrentTime());
		
		ClientPhone cp2=new ClientPhone();
		cp2.setCid(cid);
		cp2.setCreator(creatorId);
		cp2.setState(1);
		cp2.setPhone(phone2);
		cp2.setId(phone2Id);
		cp2.setCreated(TimeTool.getCurrentTime());
		
		ClientPhone cp3=new ClientPhone();
		cp3.setCid(cid);
		cp3.setCreator(creatorId);
		cp3.setState(1);
		cp3.setPhone(phone3);
		cp3.setId(phone3Id);
		cp3.setCreated(TimeTool.getCurrentTime());
		
		cps.add(cp1);
		cps.add(cp2);
		cps.add(cp3);
		
		
		ClientExtend ce0=null;
		Session session = cs.getClientBaseDao().getSessionFactory().getCurrentSession();
		Criteria criteria=null;
		Transaction tx=null;
		try{
		tx = session.beginTransaction();
		

		// modify start
		if (oppType == 2 && cid!=0) { 
			System.out.println("####");
			criteria = session.createCriteria(ClientExtend.class);
			criteria.add(Restrictions.eq("cid", Math.abs(this.cid)));	//cid 有可能是负数
			ce0 = (ClientExtend) criteria.list().get(0);
			ce.setId(ce0.getId());
			ce.setCreated(ce0.getCreated());
			session.merge(ce);
			
			criteria = session.createCriteria(ClientBase.class);
			criteria.add(Restrictions.eq("cid", this.cid));
			ClientBase cb0 = (ClientBase) criteria.list().get(0);		
			
			if (cb0.getCreator().equals(creatorId)){
				isOwn = true;
				System.out.println(isOwn);
			}
				
			if(isOwn){
				//addressId不变的情况
				if(provinceId.equals("0") && cityId.equals("0") && areaId.equals("0")){
					cb.setProvinceId(cb0.getProvinceId());
					cb.setProvince(cb0.getProvince());
					cb.setCityId(cb0.getCityId());
					cb.setCity(cb0.getCity());
					cb.setAreaId(cb0.getAreaId());
					cb.setArea(cb0.getArea());
				}
				
				
				
				cb.setCreated(cb0.getCreated());	//创建时间还是保持不变
				cb.setOriginId(cb0.getOriginId());
				cb.setModifier(creatorId);			//clientBase只有创建人能够修改
				session.merge(cb);
			
			// phone modify start
			for(ClientPhone p:cps){		//修改电话（电话只能作废 新增 不能修改）
				if(p.getPhone().equals(""))
					continue;
				
				
				if(p.getId()!=0){		
				
				
					criteria = session.createCriteria(ClientPhone.class);
					criteria.add(Restrictions.eq("id", Math.abs(p.getId())));	//注意：作废的电话id为负数
					ClientPhone cp0 = (ClientPhone) criteria.list().get(0);
					
	
					if(p.getId()>0){					//这种情况不允许出现（因为phone只能新增或者作废）
						p.setCreated(cp0.getCreated());	//这样是否修改的时候就不会修改该项目？？
						session.merge(p);
						
					}else if(p.getId()<0){
						cp0.setPhone("#"+cp0.getPhone());
						cp0.setState(2);	//作废状态
						cp0.setWasted(TimeTool.getCurrentTime());	//作废时间
						session.merge(cp0);	//不能真正的删除
					}
					
				}else
					session.merge(p);		//add new phone
				
				
				
			}
			// phone modify end
			
			}else
				this.tip="非本人创建的客户不能修改客户基本信息";
		}	// modify end
		
		//add start
		else if(oppType==1 && cid==0) {	
			cb.setCreated(TimeTool.getCurrentTime());
			cb.setOriginId(0);	//非推荐客户
			session.save(cb);
			@SuppressWarnings("unchecked")
			List<Integer> results = session
					.createCriteria(ClientBase.class)
					.setMaxResults(1)
					.setProjection(
							Projections.projectionList().add(
									Projections.max("cid"))

					).list();
			Integer maxId = results.get(0);
			
			ce.setId(0);		//会自动生成主键
			ce.setCreated(TimeTool.getCurrentTime());
			ce.setCid(maxId);
			ce.setState(1);
			session.merge(ce);
			
			for(ClientPhone p:cps){
				if(p.getPhone().equals(""))
					continue;
				p.setCid(maxId);		//将cid写入
				p.setId(null);
				session.save(p);
			}

			
		}	//add end
		else{
			this.tip="请检查初始条件是否正确！";
			return -2;
		}
			
		
		tx.commit();
		this.tip="修改或添加成功！";
		return 1;
		}catch(Exception e){
			tx.rollback();
			this.tip="修改或添加失败";
			e.printStackTrace();
			return -1;			//修改或添加失败
		}finally{
			if(session.isOpen())
				session.close();
		}
	}

	//新增客户的入口
	public String execute() {
		// TODO Auto-generated method stub
		this.opType=1;
		return SUCCESS;
	}

	/**
	 * 使用方法：
	 * (phones <= 3)
	 * opType:
	 * 1:add 2:modify
	 * cid:
	 * 0:add >0:modify
	 * phoneNId:
	 * 0:add <0:waste (phone's id=Math.abs(phoneNId))
	 * addCodes:
	 * "0|0|0":noChange 
	 * 
	 * 
	 * @param args
	 * @throws Exception
	 */
	public static void main(String[] args) throws Exception {
		ClientAction5 c = new ClientAction5();
		
		

		
		
//		c.setOpType(1);	// 1:add 2:modify
//		c.setCid(0);
//		c.setName("张四");
//		c.setComName("公司四");
//		c.setMemo("备注111");
//		c.setAddCodes("610000|610100|610103");	//101~104 113
//		c.setPhone1("13800000005");
//		c.setPhone1Id(0);
		
//		c.setChose1(new String[]{"卡特","小松"});
//		c.setChose2(new String[]{"柳工","临工"});
//		c.setChose3(new String[]{"装载机","其他"});

//		c.setChose4("b");	//客户类型
//		c.setChose5("b");
//		c.setChose6(new Integer(1));
		
//		c.setOpType(2);	// 1:add 2:modify 修改并新增电话
//		c.setCid(108);
//		c.setName("隔壁老唐改");
//		c.setComName("微软1");
//		c.setAddCodes("0|0|0");
////		c.setAddCodes("610000|610100|610114");
//		c.setPhone1("15966666671");
//		c.setPhone1Id(0);
		
//		c.setOpType(2);	// 1:add 2:modify 修改并作废电话
//		c.setCid(108);
//		c.setName("隔壁老张改");
//		c.setComName("微软4");
//		c.setAddCodes("0|0|0");
//		c.setPhone1("15966666670");
//		c.setPhone1Id(-55);		
	
//		String result=c.edit();
//		System.out.println(result);
//		System.out.println(c.getTip());	
			
//		c.showList(1, 3, false, 3, 0);
//		List<ClientDetail> list=c.getClientList();
//		for(ClientDetail cd:list){
//			System.out.println(cd.getClientBase().getName());
//		}
		
		c.show();
		
	}
	
	

	public Integer getCid() {
		return cid;
	}

	public void setCid(Integer cid) {
		this.cid = cid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getComName() {
		return comName;
	}

	public void setComName(String comName) {
		this.comName = comName;
	}

	public String getMemo() {
		return memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}

	public String[] getChose1() {
		return chose1;
	}

	public void setChose1(String[] chose1) {
		this.chose1 = chose1;
	}

	public String[] getChose2() {
		return chose2;
	}

	public void setChose2(String[] chose2) {
		this.chose2 = chose2;
	}

	public String[] getChose3() {
		return chose3;
	}

	public void setChose3(String[] chose3) {
		this.chose3 = chose3;
	}

	public String getChose4() {
		return chose4;
	}

	public void setChose4(String chose4) {
		this.chose4 = chose4;
	}

	public String getChose5() {
		return chose5;
	}

	public void setChose5(String chose5) {
		this.chose5 = chose5;
	}

	public Integer getChose6() {
		return chose6;
	}

	public void setChose6(Integer chose6) {
		this.chose6 = chose6;
	}

	public String getPhone1() {
		return phone1;
	}

	public void setPhone1(String phone1) {
		this.phone1 = phone1;
	}

	public String getPhone2() {
		return phone2;
	}

	public void setPhone2(String phone2) {
		this.phone2 = phone2;
	}

	public String getPhone3() {
		return phone3;
	}

	public void setPhone3(String phone3) {
		this.phone3 = phone3;
	}

	public Integer getPhone1Id() {
		return phone1Id;
	}

	public void setPhone1Id(Integer phone1Id) {
		this.phone1Id = phone1Id;
	}

	public Integer getPhone2Id() {
		return phone2Id;
	}

	public void setPhone2Id(Integer phone2Id) {
		this.phone2Id = phone2Id;
	}

	public Integer getPhone3Id() {
		return phone3Id;
	}

	public void setPhone3Id(Integer phone3Id) {
		this.phone3Id = phone3Id;
	}

	public Integer getPageNo() {
		return pageNo;
	}

	public void setPageNo(Integer pageNo) {
		this.pageNo = pageNo;
	}

	public Integer getPageSize() {
		return pageSize;
	}

	public void setPageSize(Integer pageSize) {
		this.pageSize = pageSize;
	}

	public Integer getTotal() {
		return total;
	}

	public void setTotal(Integer total) {
		this.total = total;
	}

	public List<ClientDetail> getClientList() {
		return clientList;
	}

	public void setClientList(List<ClientDetail> clientList) {
		this.clientList = clientList;
	}

	public Integer getOrderCon() {
		return orderCon;
	}

	public void setOrderCon(Integer orderCon) {
		this.orderCon = orderCon;
	}

	public boolean isDesc() {
		return isDesc;
	}

	public void setDesc(boolean isDesc) {
		this.isDesc = isDesc;
	}

	public String getCjsons() {
		return cjsons;
	}

	public void setCjsons(String cjsons) {
		this.cjsons = cjsons;
	}

	public ClientDetail getClientDetail() {
		return clientDetail;
	}

	public void setClientDetail(ClientDetail clientDetail) {
		this.clientDetail = clientDetail;
	}

	public Integer getOpType() {
		return opType;
	}

	public void setOpType(Integer opType) {
		this.opType = opType;
	}

	public Integer getPhoneNum() {
		return phoneNum;
	}

	public void setPhoneNum(Integer phoneNum) {
		this.phoneNum = phoneNum;
	}

	public String getProvinceId() {
		return provinceId;
	}

	public void setProvinceId(String provinceId) {
		this.provinceId = provinceId;
	}

	public String getCityId() {
		return cityId;
	}

	public void setCityId(String cityId) {
		this.cityId = cityId;
	}

	public String getAreaId() {
		return areaId;
	}

	public void setAreaId(String areaId) {
		this.areaId = areaId;
	}

}
